import request from "@/services";

// 二维码 key 生成接口
export const LoginQrKeyAPI = () => {
  return request.get<any>({
    url: "/login/qr/key",
    params: {
      timestamp: +new Date()
    }
  })
}

// 二维码生成接口
export const LoginQrCreateAPI = (key: string) => {
  return request.get<any>({
    url: "/login/qr/create",
    params: {
      key,
      timestamp: +new Date()
    }
  })
}

// 检测二维码
export const LoginQrCheckAPI = (key: string) => {
  return request.get<any>({
    url: '/login/qr/check',
    params: {
      key,
      timestamp: +new Date()
    }
  })
}

// 用户登录状态
export const LoginStatusAPI = () => {
  return request.get<any>({
    url: '/login/status',
    params: {
      timestamp: +new Date()
    }
  })
}

// 刷新获取登录
export const LoginRefreshAPI = () => {
  return request.get<any>({
    url: '/login/refresh',
    params: {
      timestamp: +new Date()
    }
  })
}

// 获取账号信息
export const userAccountAPI = () => {
  return request.get<any>({
    url: '/user/account',
    params: {
      timestamp: +new Date()
    }
  })
}

// 获取用户信息 , 歌单，收藏，mv, dj 数量
export const userSubcountAPI = (uid: number) => {
  return request.get<any>({
    url: '/user/playlist',
    params: {
      uid
    }
  })
}

// 发送验证码
export const CaptchaSentAPI = (phone: number) => {
  return request.get<any>({
    url: '/captcha/sent',
    params: {
      phone,
      timestamp: +new Date()
    }
  })
}

// 验证验证码
export const CaptchaVerifyAPI = (phone: number, captcha: number) => {
  return request.get<any>({
    url: '/captcha/verify',
    params: {
      phone,
      captcha,
      timestamp: +new Date()
    }
  })
}

// 退出登录
export const LogoutAPI = () => {
  return request.get<any>({
    url: '/logout',
  })
}